<extend name="Layout:ly2"/>

<block name="head">
<script type="text/javascript">
$(function(){
    $("#btn-submit").click(function(){
        var userid = $("input[name='userid']").val();
        var name = $("input[name='name']").val();
        var expert_type = $("input[name='expert_type']").val();
        var good_at_crop = $("input[name='good_at_crop']").val();
        var good_at_area = $("input[name='good_at_area']").val();
        var qq = $("input[name='qq']").val();
        var postion = $("input[name='postion']").val();
        var company = $("input[name='company']").val();
        var content = $("textarea").val();
        var status = $("input[name='status']:checked").val();

        if (name == '') {layer.msg('专家名不能为空');return false;}

        $.get("{:U('Admin/Expert/expert_edit')}",{'action':'edit','userid':userid,'name':name,'expert_type':expert_type,'good_at_crop':good_at_crop,'good_at_area':good_at_area,'qq':qq,'postion':postion,'company':company,'content':content,'status':status},function(msg){
            if(msg == 1){
                layer.msg("更新成功，1秒后自动关闭~~",{ico:1,time:1000},function(){
                    parent.window.location.reload();    //刷新父页面
                })
            }else if(msg == 2){
                layer.msg("参数异常，1秒后自动关闭~~",{ico:1,time:1000},function(){
                    parent.window.location.reload();    //刷新父页面
                })
            }else{
                layer.msg("更新失败，1秒后自动关闭~~",{ico:1,time:1000},function(){
                    parent.window.location.reload();    //刷新父页面
                })
            }
        })
    })
})
</script>

</block>

<block name="body">
    <div class="container-fluid">
        <h3 id="title" align="center">专家编辑</h3>
        <div class="padding20">
            <div class="form-horizontal p90">
                <input type="hidden" name="userid" value="{$data[0]['userid']}" />
                <div class="form-group">
                    <label class="col-sm-2 control-label">专家名称：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="name" value="{$data[0]['name']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">专家类型：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="expert_type" value="{$data[0]['expert_type']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">擅长作物：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="good_at_crop" value="{$data[0]['good_at_crop']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">擅长地区：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="good_at_area" value="{$data[0]['good_at_area']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">QQ：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="qq" value="{$data[0]['qq']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">职称：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="postion" value="{$data[0]['postion']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">单位：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control nobg" name="company" value="{$data[0]['company']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">个人介绍：</label>
                    <div class="col-sm-10">
                        <textarea class="form-control" class="content" name="content" rows="3">{$data[0]['content']}</textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">状态：</label>
                    <div class="col-sm-10">
                        <input type="radio" name="status" <if condition="$data[0]['status'] eq 0">checked</if> value="0">
                        <lavel> 待审核 </lavel>&nbsp;&nbsp;
                        <input type="radio" name="status" <if condition="$data[0]['status'] eq 1">checked</if> value="1">
                        <lavel> 已通过</lavel>&nbsp;&nbsp;
                        <input type="radio" name="status" <if condition="$data[0]['status'] eq 2">checked</if> value="2">
                        <lavel> 未通过</lavel>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" id="btn-submit" class="btn btn-success">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
                        <button type="reset" class="btn btn-default">重置</button>
                    </div>
                </div>

            </div>
        </div>
    </div>

</block>